<?php
session_start();
/// O My Friends: Personal Social Network Graph on Facebook
/// author : Minkyu Shim (minkyu.shim@gmail.com)
/// homepage : http://code.google.com/p/omyfriends
/// login.php
/// get a session key from facebook server and save it into a session and redirect to index.php

$lib_dir = dirname(__FILE__).'/lib/';
require_once $lib_dir.'config.php';
require_once $lib_dir.'facebook.php';

$facebook = new Facebook(array(
    'appId'  => FB_APP_ID,
    'secret' => FB_APP_SECRET
));

//get user
$user = $facebook->getUser();

$redirect_url = 'http://'.$_SERVER['SERVER_NAME'].'/'.basename(__FILE__).'/';

header('Location:'.$redirect_url );

